﻿using System;
using System.ComponentModel.Composition;
using System.Windows.Controls;
using System.Windows.Navigation;
using GalaSoft.MvvmLight.Messaging;

namespace Songhay.Silverlight.BiggestBox.IndexPart.Views
{
    using Songhay.Mvvm.Models;
    using Songhay.Mvvm.Views;

    [Export(typeof(Page))]
    public partial class UserControlsPage : Page, IComposableView
    {
        public UserControlsPage()
        {
            InitializeComponent();
        }

        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            base.OnNavigatedTo(e);

            var message = new LightNavigationMessage<NavigationEventArgs>(e.Uri.OriginalString, e)
            {
                Source = LightMessageSource.ViewNavigatedTo,
                UniqueId = "UserControlsPage"
            };
            Messenger.Default.Send(message);
        }

        #region IComposableView Members

        public void DoNavigateFrom(Uri targetUri)
        {
            throw new System.NotImplementedException();
        }

        public void DoNavigateTo(Uri targetUri)
        {
            var e = new NavigationEventArgs(this, targetUri);
            this.OnNavigatedTo(e);
        }

        #endregion
    }
}
